package com.erp.erp_mask.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.erp.erp_mask.pojo.TRolePermissions;
import com.erp.erp_mask.service.TRolePermissionsService;
import com.erp.erp_mask.mapper.TRolePermissionsMapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
* @author yang
* @description 针对表【t_role_permissions】的数据库操作Service实现
* @createDate 2024-05-13 14:57:47
*/
@Service
public class TRolePermissionsServiceImpl extends ServiceImpl<TRolePermissionsMapper, TRolePermissions>
    implements TRolePermissionsService{

    @Override
    @Transactional
    public void grant(Long roleId, Long[] ids) {
        baseMapper.deleteByRoleId(roleId);
        for (Long permId:ids){
            baseMapper.add(roleId,permId);
        }
    }
}




